package org.harsh.app;

import lombok.extern.slf4j.Slf4j;
import org.harsh.transmission.server.NodeServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.stereotype.Component;

@Slf4j
@ComponentScan(basePackages=("org.harsh"))
public class ServerApp implements CommandLineRunner {
    @Autowired
    private NodeServer nodeServer;

    @Override
    public void run(String... args) throws Exception {
        try {
            nodeServer.start();
        } finally {
            nodeServer.destory();
        }
    }

    public static void main(String[] args) {
        SpringApplication.run(ServerApp.class, args);
    }
}
